import smtplib
import time
import datetime
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
 
gmail_user = "mimmoozz@gmail.com"
gmail_pwd = "2919384nboitr"
 
def mail(to, subject, text):
	msg = MIMEMultipart()
	 
	msg['From'] = gmail_user
	msg['To'] = to
	msg['Subject'] = subject
	 
	msg.attach(MIMEText(text))
	 
	mailServer = smtplib.SMTP("smtp.gmail.com", 587)
	mailServer.ehlo()
	mailServer.starttls()
	mailServer.ehlo()
	mailServer.login(gmail_user, gmail_pwd)
	mailServer.sendmail(gmail_user, to, msg.as_string())
	mailServer.close()
	 
file = open('body.txt','r')
document = file.read()
mail("mimmooz@tiscali.it",
"prova Invio",
document,
)
